package org.LZQ.ShortLink.admin.remote;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.LZQ.ShortLink.admin.common.convention.result.Result;
import org.LZQ.ShortLink.admin.config.OpenFeignConfiguration;
import org.LZQ.ShortLink.admin.dto.req.RecycleBinRecoverReqDTO;
import org.LZQ.ShortLink.admin.dto.req.RecycleBinRemoveReqDTO;
import org.LZQ.ShortLink.admin.remote.dto.req.RecycleBinSaveReqDTO;
import org.LZQ.ShortLink.admin.remote.dto.req.ShortLinkBatchCreateReqDTO;
import org.LZQ.ShortLink.admin.remote.dto.req.ShortLinkCreateReqDTO;
import org.LZQ.ShortLink.admin.remote.dto.req.ShortLinkUpdateReqDTO;
import org.LZQ.ShortLink.admin.remote.dto.resp.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "short-link-project",configuration = OpenFeignConfiguration.class)
public interface RemoteService {
    /**
     * 短链接创建
     * @param requestParam
     * @return
     */
    @PostMapping("/api/shortLink/project/shortLink/create")
    Result<ShortLinkCreateRespDTO> createShortLink(ShortLinkCreateReqDTO requestParam);

    /**
     * 批量创建短链接
     * @param requestParam
     * @return
     */
    @PostMapping("/api/shortLink/project/shortLink/create/batch")
    Result<ShortLinkBatchCreateRespDTO> batchCreateShortLink(ShortLinkBatchCreateReqDTO requestParam);

    /**
     * 修改短连接
     * @param requestParam
     */
    @PostMapping("/api/shortLink/project/shortLink/update")
    void updateShortLink(ShortLinkUpdateReqDTO requestParam);

    /**
     * 分页查询短链接
     * @param gid
     * @param orderTag
     * @param current
     * @param size
     * @return
     */
    @GetMapping("/api/shortLink/project/shortLink/page")
    Result<Page<ShortLinkPageRespDTO>> pageShortLink(@RequestParam("gid") String gid,
                                                     @RequestParam("orderTag") String orderTag,
                                                     @RequestParam("current") Long current,
                                                     @RequestParam("size") Long size);
    /**
     * 查询短链接分组总量
     * @param requestParam
     * @return
     */
    @GetMapping("/api/shortLink/project/shortLink/count")
    Result<List<ShortLinkGroupCountQueryRespDTO>> listGroupShortLinkCount(@RequestParam("requestParam") List<String> requestParam);

    /**
     * 获取短链接标题
     * @param url
     * @return
     */
    @GetMapping("/api/shortLink/project/title")
    Result<String> getTitleByUrl(@RequestParam("url") String url);

    /**
     * 保存回收站
     * @param requestParam
     */
    @PostMapping("/api/shortLink/project/recycleBin/save")
    void saveRecycleBin(RecycleBinSaveReqDTO requestParam);

    /**
     * 恢复短链接
     * @param requestParam
     */
    @PostMapping("/api/shortLink/project/recycleBin/recover")
    void recoverRecycleBin(RecycleBinRecoverReqDTO requestParam);

    /**
     * 删除短链接
     * @param requestParam
     */
    @PostMapping("/api/shortLink/project/recycleBin/remove")
    void removeRecycleBin(RecycleBinRemoveReqDTO requestParam);

    /**
     * 分页查询回收站短链接
     * @param gidList
     * @param current
     * @param size
     * @return
     */
    @GetMapping("/api/shortLink/project/recycleBin/page")
    Result<Page<ShortLinkPageRespDTO>> pageRecycleBinShortLink(@RequestParam("gidList") List<String> gidList,
                                                               @RequestParam("current") Long current,
                                                               @RequestParam("size") Long size);

    /**
     * 访问单个短链接指定时间内监控数据
     * @param fullShortUrl
     * @param gid
     * @param enableStatus
     * @param startDate
     * @param endDate
     * @return
     */
    @GetMapping("/api/shortLink/project/stats")
    Result<ShortLinkStatsRespDTO> shortLinkStats(@RequestParam("fullShortUrl") String fullShortUrl,
                                                 @RequestParam("gid") String gid,
                                                 @RequestParam("enableStatus") Integer enableStatus,
                                                 @RequestParam("startDate") String startDate,
                                                 @RequestParam("endDate") String endDate);

    /**
     * 分组查询短链接指定时间内监控数据
     * @param gid
     * @param startDate
     * @param endDate
     * @return
     */
    @GetMapping("/api/shortLink/project/stats/access-record/group")
    Result<ShortLinkStatsRespDTO> groupShortLinkStats(@RequestParam("gid") String gid,
                                                      @RequestParam("startDate") String startDate,
                                                      @RequestParam("endDate") String endDate);

    /**
     * 访问短链接指定时间内监控数据
     * @param fullShortUrl
     * @param gid
     * @param startDate
     * @param endDate
     * @param enableStatus
     * @param current
     * @param size
     * @return
     */
    @GetMapping("/api/shortLink/project/stats/access-record")
    Result<Page<ShortLinkStatsAccessRecordRespDTO>> shortLinkStatsAccessRecord(@RequestParam("fullShortUrl") String fullShortUrl,
                                                                                @RequestParam("gid") String gid,
                                                                                @RequestParam("startDate") String startDate,
                                                                                @RequestParam("endDate") String endDate,
                                                                                @RequestParam("enableStatus") Integer enableStatus,
                                                                                @RequestParam("current") Long current,
                                                                                @RequestParam("size") Long size);
    @GetMapping("/api/shortLink/project/stats/access-record/group")
    Result<IPage<ShortLinkStatsAccessRecordRespDTO>> groupShortLinkStatsAccessRecord(@RequestParam("gid") String gid,
                                                                                     @RequestParam("startDate") String startDate,
                                                                                     @RequestParam("endDate") String endDate,
                                                                                     @RequestParam("current") Long current,
                                                                                     @RequestParam("size") Long size);
}
